<include file="Public/header"/>
<include file="Public/menu"/>

<!-- 内容页 -->
<div class="content-wrapper">
    <!-- 面包屑 -->
    <section class="content-header">
        <h1>
            首页
            <small>管理</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 首页管理</a></li>
            <li class="active">轮播图管理</li>
        </ol>
    </section>

    <!-- 内容 -->
    <section class="content">

        <div class="tab-content">
            <div class="tab-pane active" id="tab_0">
                <div class="box">
                    <div class="box-header">
                        <h3 class="box-title"></h3>

                        <div class="btn-group pull-left" style="margin-right: 10px">
                            <a href="/admin/carousel/add" class="btn btn-sm btn-success"><i class="fa fa-save"></i>&nbsp;&nbsp;新增轮播图</a>
                        </div>

                    </div>
                    <!-- /.box-header -->
                    <div class="box-body table-responsive no-padding">
                        <table class="table table-hover">
                            <tbody>
                            <tr>
                                <th></th>
                                <th>菜单名称</th>
                                <th>类型</th>
                                <th>url</th>
                                <th>图片</th>
                                <th>排序</th>
                                <th>显示</th>
                                <th>操作</th>
                            </tr>
                            <foreach name="carousel" item="v" >
                                <tr>
                                    <td></td>
                                    <td>{$v.name}</td>
                                    <td><span class="label label-success">{$v.type}</span></td>
                                    <td>
                                    <if condition="$v['type'] == '图链接'">
                                        {$v.url}
                                    </if>
                                    </td>
                                    <td><img src="/Uploads/{$v.img}" style="max-width:50px;max-height:50px" class="img img-thumbnail"></td>
                                    <td>{$v.order}</td>
                                    <td><?php echo $v['status'] == '1' ? '是' :'否';?></td>
                                    <td>
                                        <if condition="$v['type'] == '产品列表'">
                                            <a href-data="/admin/carousel/productAdd/id/{$v.id}" class="btn btn-sm btn-success add_product">添加产品列表</a>
                                            <elseif condition="$v['type'] == '产品详情'"/>
                                            <a href-data="/admin/carousel/productDetail/id/{$v.id}" class="btn btn-sm btn-success add_product">添加产品详情</a>
                                        </if>
                                        <a href="/admin/carousel/edit/id/{$v.id}" class="btn btn-sm btn-success grid-refreshe">编辑</a>
                                        <a href="/admin/carousel/delete/id/{$v.id}"
                                           class="delete btn btn-warning btn-success grid-refreshe">删除</a>
                                    </td>
                                </tr>
                            </foreach>
                            </tbody>
                        </table>
                    </div>
                    <div class="box-footer clearfix">
                        <!--<input type="checkbox" class="grid-select-all">&nbsp;&nbsp;&nbsp;-->
                        <a class="btn btn-sm btn-primary grid-refresh"><i class="fa fa-refresh"></i></a>
                        <ul class="pagination pagination-sm no-margin pull-right"></ul>
                    </div>
                    <!-- /.box-body -->
                </div>
            </div>

        </div>
    </section>
</div>
<!-- 底部 -->
<include file="Public/common_footer"/>
<script src="/Public/layer/layer.js"></script>
<script>

    $(function () {

        $('.delete').click(function () {
            if(!confirm("确定删除？"))
            {
                return false;
            }
        });

        $('.add_product').on('click', function(){
            var href = $(this).attr('href-data');
            layer.ready(function(){
                layer.open({
                    type: 2,
                    title: '添加产品列表',
                    fix: false,
                    maxmin: true,
                    shadeClose: true,
                    area: ['1100px', '800px'],
                    content: href,
                    end: function(){
                        layer.tips('Hi', '#about', {tips: 1})
                    }
                });
            });
        });
    })



</script>
